home *** CD-ROM | disk | FTP | other *** search
- Path: news.magi.com!news!news.magi.com
- From: nredding@magi.com (Neil Redding)
- Newsgroups: comp.lang.c
- Subject: Re: getchar() problems!
- Date: Sat, 13 Jan 1996 19:24:54 -0500
- Organization: Magi Data Consulting
- Message-ID: <nredding-1301961924540001@magi04p17.magi.com>
- References: <DL2wFD.8BK@cdf.toronto.edu>
- NNTP-Posting-Host: magi04p17.magi.com
-
- In article <DL2wFD.8BK@cdf.toronto.edu>, a228lave@cdf.toronto.edu
- (Laventure Derek) wrote:
-
- >Hello!
- >
- >I am having some trouble with the following code. All I want it to do is
- >read characters from the keyboard until the user types a # sign, at which point
- >I want to stop accepting input, and tell the user some info. Here it is:
- >
- ...
- > char ch;
-
- > while ((ch=getchar()) != '#')
-
- >What _actually_ happens is the code takes characters until you hit the #, and
- >then continues until you press return. Also, the final ch=getchar(); line
- >appears to be ignored... it's intended as a pause. I'm somewhat of a beginner
- >to the language, so any help will be greatly appreciated!
- >
- Well for one thing, getchar RETURNS AN INT . . . NOT A CHAR.
-
- --
- Neil Redding
- Ottawa, Canada
-